varying vec3 vPosition;
varying vec3 vTexcoord0;
varying vec3 vNormal;
uniform vec3 uLightPosition;
uniform vec4 uDiffuseColor;
uniform vec4 uLightColor;
uniform float uShininess;

void main()
{
    vec3 P=vPosition;
    vec3 L=uLightPosition;
    vec3 V=vec3(0,0,0);	
    vec3 l=normalize(L-P);
    vec3 v=normalize(V-P);
    vec3 h=normalize(l+v);
    vec3 n=normalize(vNormal);
    float a=100.0;
	
	float nh=dot(n,h);
	float nl=dot(n,l);
	float lh=dot(l,h);
	vec4 Cdiff=vec4(0.5,0.5,0.5,1.0);
	vec4 Cspec=vec4(1.0,1.0,1.0,1.0);
	vec4 Clight=vec4(1.0,1.0,1.0,1.0);
	vec4 F=Cspec+(vec4(1.0,1.0,1.0,1.0)-Cspec)*(1-pow(lh,5));
	gl_FragColor=((a+2)/8*pow(nh,a)*F+Cdiff)*Clight*nl;
	
	//gl_FragColor=(Cdiff+Cspec*pow(nh,a))*Clight*nl;
}